a tool for shared writing and social publishing
1"use client";
2import { useUIState } from "src/useUIState";
3import { Footer as ActionFooter } from "components/ActionBar/Footer";
4import { Media } from "components/Media";
5import { ThemePopover } from "components/ThemeManager/ThemeSetter";
6import { Toolbar } from "components/Toolbar";
7import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions";
8import { HomeButton } from "app/[leaflet_id]/actions/HomeButton";
9import { PublishButton } from "./actions/PublishButton";
10import { useEntitySetContext } from "components/EntitySetProvider";
11import { HelpButton } from "app/[leaflet_id]/actions/HelpButton";
12import { Watermark } from "components/Watermark";
13import { BackToPubButton } from "./actions/BackToPubButton";
14import { useLeafletPublicationData } from "components/PageSWRDataProvider";
15import { useIdentityData } from "components/IdentityProvider";
16
17export function LeafletFooter(props: { entityID: string }) {
18 let focusedBlock = useUIState((s) => s.focusedEntity);
19 let entity_set = useEntitySetContext();
20 let { identity } = useIdentityData();
21 let { data: pub } = useLeafletPublicationData();
22
23 return (
24 <Media mobile className="mobileFooter w-full z-10 touch-none -mt-[54px] ">
25 {focusedBlock &&
26 focusedBlock.entityType == "block" &&
27 entity_set.permissions.write ? (
28 <div
29 className="w-full z-10 p-2 flex bg-bg-page pwa-padding-bottom"
30 onMouseDown={(e) => {
31 if (e.currentTarget === e.target) e.preventDefault();
32 }}
33 >
34 <Toolbar
35 pageID={focusedBlock.parent}
36 blockID={focusedBlock.entityID}
37 />
38 </div>
39 ) : entity_set.permissions.write ? (
40 <ActionFooter>
41 {pub?.publications &&
42 identity?.atp_did &&
43 pub.publications.identity_did === identity.atp_did ? (
44 <BackToPubButton publication={pub.publications} />
45 ) : (
46 <HomeButton />
47 )}
48
49 <PublishButton entityID={props.entityID} />
50 <ShareOptions />
51 <ThemePopover entityID={props.entityID} />
52 </ActionFooter>
53 ) : (
54 <div className="pb-2 px-2 z-10 flex justify-end">
55 <Watermark mobile />
56 </div>
57 )}
58 </Media>
59 );
60}